﻿
var BENCHMARKS = (function () {
    var _this = {};
    var N = _this.N = 1000;
    var M = _this.M = 10;    
    _this.timeprofile = function (fn, name) {
        if (arguments.length < 2) { name = "" };
        var t0 = new Date().getTime();
        fn();
        var s = name + (new Date().getTime() - t0) + " ms";
        console.log(s);
        return s;
    };

    _this.dataSource = (function (nRows, nCols) {

        var orgz = ["Microsoft", "Google", "Apple", "W3C"];
        var states = ["CA", "WA", "DC", "NY"];
        var items = [];
        var Item = function (c, s) {
            this.org = c;
            this.state = s;
        };
        var c, s;
        for (var i = 0; i < nRows; i++) {
            c = orgz[Math.floor(i / (nRows / 4))];
            s = states[i % 4];
            var item = new Item(c, s);
            for (var j = 0; j < nCols; j++) {
                item["field" +  j] = Math.random() * 1000;
            }
            items.push(item);
        }
        return items;
    } (N, M));
    return _this;
} ());

